// let api = 'https://pms.block-os.com/'//生产运营
// let api = 'https://commercial-rent.block-os.com/' //生产资管
// let api = 'https://pam.jh-sg.com/' //生产资管
// let api = 'http://sit-commercial-rent.block-os.com/'//测试
// let api = 'http://192.168.1.131:10027/'
let api = 'https://opm.jh-sg.com/'//测试
// let api = 'https://sit-pam.muonstar.com/'//测试

// let businessAssets = 'https://pms.block-os.com/'//生产运营
// let businessAssets = 'https://commercial-rent.block-os.com/' //生产资管
// let businessAssets = 'https://pam.jh-sg.com/' //生产资管
// let businessAssets = 'https://sit-commercial-rent.block-os.com/'
let businessAssets = 'https://opm.jh-sg.com/'
// let businessAssets = 'https://sit-pam.muonstar.com/'

// let businessContract = 'https://pms.block-os.com/'//生产运营
// let businessContract = 'https://commercial-rent.block-os.com/' //生产资管
// let businessContract = 'https://pam.jh-sg.com/' //生产资管
// let businessContract = 'https://sit-commercial-rent.block-os.com/'
let businessContract = 'https://opm.jh-sg.com/'
// let businessContract = 'https://sit-pam.muonstar.com/'

// let financialplan = 'https://pms.block-os.com/'//生产运营
// let financialplan = 'https://commercial-rent.block-os.com/' //生产资管
// let financialplan = 'https://pam.jh-sg.com/' //生产资管
// let financialplan = 'https://sit-commercial-rent.block-os.com/'
let financialplan = 'https://opm.jh-sg.com/'
// let financialplan = 'https://sit-pam.muonstar.com/'

// let flowApi = 'https://pms.block-os.com/'//生产运营
// let flowApi = 'https://commercial-rent.block-os.com/' //生产资管
// let flowApi = 'https://pam.jh-sg.com/' //生产资管
// let flowApi = 'http://sit-process-saas.block-os.com/'
let flowApi = 'https://opm.jh-sg.com/'
// let flowApi = 'https://sit-pam.muonstar.com/'


function handleUrl(url, server) {
  if (url.indexOf('192.168.') > -1) {
    return url
  } else {
    return url + server
  }
}
module.exports = {
  port: '10619', // 代理端口
  proxy: {
    // base
    '/server-api': { // 匹配所有以 '/api'开头的请求路径
      target: handleUrl(api, 'server-api/'),
      changeOrigin: true, // 支持跨域
      pathRewrite: { // 重写路径: 去掉路径中开头的'/api'
        '^/server-api': ''
      }
    },
    // 权限
    '/auth-api': { // 匹配所有以 '/api'开头的请求路径 登录：18548922022
      target: handleUrl(api, 'auth-api/'),
      changeOrigin: true, // 支持跨域
      secure: false, // 如果是https接口，需要配置这个参数
      pathRewrite: { // 重写路径: 去掉路径中开头的'/api'
        '^/auth-api': ''
      }
    },
    // 资管
    '/commercialrent': { // 匹配所有以 '/api'开头的请求路径 登录：17888886661
      target: handleUrl(businessAssets, 'commercialrent/'),
      changeOrigin: true, // 支持跨域
      pathRewrite: { // 重写路径: 去掉路径中开头的'/api'
        '^/commercialrent': ''
      }
    },
    // 合同
    '/commercialcontract': { // 匹配所有以 '/api'开头的请求路径 登录：17888886661
      target: handleUrl(businessContract, 'commercialcontract/'),
      changeOrigin: true, // 支持跨域
      pathRewrite: { // 重写路径: 去掉路径中开头的'/api'
        '^/commercialcontract': ''
      }
    },
    // 计划
    '/financialplan': { // 匹配所有以 '/api'开头的请求路径 登录：17888886661
      target: handleUrl(financialplan, 'financialplan/'),
      changeOrigin: true, // 支持跨域
      pathRewrite: { // 重写路径: 去掉路径中开头的'/api'
        '^/financialplan': ''
      }
    },
    // 流程相关
    '/api': { // 匹配所有以 '/api'开头的请求路径 登录：17888886661
      target: handleUrl(flowApi, 'api/'),
      changeOrigin: true, // 支持跨域
      pathRewrite: { // 重写路径: 去掉路径中开头的'/api'
        '^/api': ''
      }
    },
  },
};
